package com.qst.action.TestPersonnel;

import com.qst.BaseServlet;
import com.qst.RequestUtil;
import com.qst.WebUtil;
import com.qst.entity.TestPersonnel;
import com.qst.service.TestPersonnelService;
import com.qst.service.impl.ServiceFactory;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//@WebServlet("/testPersonnel/view.action")
public class ViewServlet extends BaseServlet {
    private TestPersonnelService testPersonnelService = ServiceFactory.getService(TestPersonnelService.class);
    @Override
    protected void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = RequestUtil.getInt(req, "id");
        TestPersonnel testPersonnel = testPersonnelService.findById(id);
        req.setAttribute("testPersonnel", testPersonnel);
        WebUtil.forward(req, resp, "/testPersonnel/view.jsp");
    }
}
